#pragma once

#define LOG(x)          mcore::Logger::get().log(x, mcore::LOG_TYPE_OK)
#define LOG_WARNING(x)  mcore::Logger::get().log(x, mcore::LOG_TYPE_WARNING)
#define LOG_ERROR(x)    mcore::Logger::get().log(x, mcore::LOG_TYPE_ERROR)

#define LOG_STREAM(x)           {mcore::Logger::get().getLogStream(mcore::LOG_TYPE_OK) << x;       mcore::Logger::get().endLogStream(mcore::LOG_TYPE_OK);}
#define LOG_STREAM_WARNING(x)   {mcore::Logger::get().getLogStream(mcore::LOG_TYPE_WARNING) << x;  mcore::Logger::get().endLogStream(mcore::LOG_TYPE_WARNING);}
#define LOG_STREAM_ERROR(x)     {mcore::Logger::get().getLogStream(mcore::LOG_TYPE_ERROR) << x;    mcore::Logger::get().endLogStream(mcore::LOG_TYPE_ERROR);}

namespace mcore
{
	enum LogType
	{
		LOG_TYPE_OK,
		LOG_TYPE_WARNING,
		LOG_TYPE_ERROR
	};

	class Logger
	{
	private:
		Logger();
	public:
		static Logger & get();
		~Logger(void);

		void log(std::string message, LogType type);

		std::ofstream & getLogStream(LogType type);
		void endLogStream(LogType type);

	private:
		std::string mFilename;
		std::ofstream mLogfile;
		//std::string logs;
	};
}


